package org.aeon.gamechatnest.mapper;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.aeon.gamechatnest.dto.UserLoginDto;
import org.aeon.gamechatnest.dto.UserVo;
import org.aeon.gamechatnest.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 89342
 * @description 针对表【user(用户表)】的数据库操作Mapper
 * @createDate 2024-05-09 09:25:50
 * @Entity org.aeon.gamechatnest.pojo.UserLoginDto
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
     * 根据索引查询用户
     *
     * @param userLoginDto
     * @return
     */
    User getByIndex(UserLoginDto userLoginDto);

    /**
     * 判断用户是否存在
     *
     * @param userId
     * @return
     */
    @Select("select exists(select 1 from user where user_id = #{userId})")
    boolean isExist(Long userId);

    /**
     * 根据id查询用户列表
     *
     * @param userIds
     * @return
     */
    List<UserVo> getByIds(@Param("userIds") List<Long> userIds);
}




